import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/position/positionAssessResult/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/position/positionAssessResult/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/position/positionAssessResult/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/position/positionAssessResult/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/position/positionAssessResult/submit',
    method: 'post',
    data: row
  })
}
/**
 * 在线阅卷-试卷详情
 * @param {string} examInstanceId 试卷实例id
 * @returns {AxiosPromise}
 */
export const getExamDetail=(examInstanceId)=>{
  return request({
    url:'/position/examInstance/detail',
    method: 'get',
    params: {
      examInstanceId
    }
  })
}
export const updateExamScore=(answerId,score)=>{
  return request({
    url:'/position/examUserAnswer/checkUserAnswer',
    method: 'post',
    params: {
      answerId,
      score
    }
  })
}
/**
 * 提交试卷 提交批改
 * @param examInstanceId
 * @returns {AxiosPromise}
 */
export const submitExam = (examInstanceId)=>{
  return request({
    url:'/position/positionAssessResult/submit',
    method: 'post',
    params: {
      examInstanceId
    }
  })
}
